Repository navigation
Conversation
tillahoffmann
left a comment
There was a problem hiding this comment.
Nice! Added some comments inline.
| return parameters | ||
|
|
||
| @wait_container_is_ready() | ||
| def declare_queue(self, queue): |
There was a problem hiding this comment.
This seems to be a duplicate (in terms of signature) of the function in line 48. Should this be removed?
There was a problem hiding this comment.
according to the logic - this method is supposed to declare multiple queues
| import pika | ||
|
|
||
| def test_declare_queue(): | ||
| rabbitmq_container = RabbitmqContainer("rabbitmq:3-management") |
There was a problem hiding this comment.
Why can we not use the standard rabbitmq:lastest tag here?
There was a problem hiding this comment.
because it does not work with rabbitmq:latest :)
|
@dabrign any plans to finish it? if no - I'll take care of this pr |
|
|
||
| @wait_container_is_ready() | ||
| def declare_vhost(self, vhost): | ||
| cmd = "rabbitmqadmin declare exchange vhost={} type={}".format(vhost) |
| RABBITMQ_DEFAULT_PASS = os.environ.get("RABBITMQ_DEFAULT_PASS", "guest") | ||
| SERVICE_STARTED = r"Server startup complete;" | ||
|
|
||
| def __init__(self, image="rabbitmq:latest"): |
There was a problem hiding this comment.
rabbitmq:latest does not have rabbitmqadmin, so all methods below which are using it do not work
| @wait_container_is_ready() | ||
| def get_connection_parameters(self): | ||
| credentials = pika.PlainCredentials(self.RABBITMQ_DEFAULT_USER, self.RABBITMQ_DEFAULT_PASS) | ||
| parameters = pika.ConnectionParameters(self.get_container_host_ip(), self.port_to_expose, |
There was a problem hiding this comment.
self.port_to_expose -> self.get_exposed_port(self.port_to_expose)
| self.with_exposed_ports(self.port_to_expose) | ||
| self.queues = list() | ||
|
|
||
| def _configure(self): |
There was a problem hiding this comment.
this method is not called at all, nowhere
|
RabbitMQ support was added in #162 |
This pull request is meant to add rabbitmq to this suite. However, it is still a 'work-in-progress', but I would like to have some opinions on this implementation and, specifically, on how to write an efficient test.
More in details, it is well known that the decorator
@wait_container_is_readyjust wait if is possible to 'talk' with the container and it does not wait until the application is ready to receive commands.For that reason, in order to successfully exit the test, I had to add a (very inelegant) sleep to wait the additional time needed for the application inside the container to be ready.
Anyone experienced similar problem?
How did you solve it?
Thanks